/********************************************************************************
 *      Copyright:  (C) 2021 Simply myself<1239726156@qq.com>
 *                  All rights reserved.
 *
 *       Filename:  my_sqlite.h
 *    Description:  This head file 
 *
 *        Version:  1.0.0(2021年08月10日)
 *         Author:  Simply myself <1239726156@qq.com>
 *      ChangeLog:  1, Release initial version on "2021年08月10日 16时08分56秒"
 *                 
 ********************************************************************************/

#ifndef _MY_SQLITE_H_
#define _MY_SQLITE_H_

#include <stdio.h>
#include <string.h>
#include <dirent.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>

#include "sqlite3.h"

#include "my_ini_parser.h"

int sqlite_create_table (sqlite3 *db, char *table_name);
char *get_cur_time (void);
int insert_data (sqlite3 *db, char *table_name, int *id, float *temp, char *timestamp);
int update_data (sqlite3 *db, char *table_name, int *id, float *temp, char *timestamp);
int delete_data (sqlite3 *db, char *table_name, int *id);

int get_id(struct database_s *DB);
static int get_id_callback(void *data, int argc, char **argv, char **azColName);

int get_max_id (struct database_s *DB);
static int get_max_id_callback(void *data, int argc, char **argv, char **azColName);

int get_min_id (struct database_s *DB);	
static int get_min_id_callback(void *data, int argc, char **argv, char **azColName);

int get_msg_num (struct database_s *DB);
static int get_msg_num_callback(void *data, int argc, char **argv, char **azColName);


#endif
